<?php
namespace app\admin\controller;
use app\common\controller\AdminBase;
use app\common\model\Configs;
use think\Controller;
use think\Config;
use think\Log;
//系统管理
class Conf extends AdminBase{
	private $db;
	
	public function _initialize(){
		parent::_initialize();
		$this->db=new Configs();
		
	}
	
	//网站设置
	public function base(){
//		dump(Config::get());
////		dump(config("validate.prefix"));
//		dump(Config::get('validate.web_icp'));exit;
		if(request()->isPost()){
			$res=$this->db->addData(input('post.'));
			if($res['valid']){
				$this->success($res['msg'],'conf/base');exit;
				
			}else{
				
				$this->error($res['msg']);exit;
			}
			
		}else{
			//获取一个一维数组
			$data=db('configs')->column('name,value');
//          $data=db('configs')->select();
//			halt($data);
			$this->assign('data',$data);
		
			
			return $this->fetch();
		}
	}
	//日志
	public function log(){
		if(request()->isPost()){
			
		}else{
			halt(Log::info('日志信息'));
			return $this->fetch();
		}
	}
	
}
